/*
 * Created on 26.10.2006 by leck
 *
 */
package de.devisnik.shifting.impl;

import org.eclipse.swt.graphics.Point;

import de.devisnik.shifting.IPuzzle;


public class Move implements IMove {
    
    private final int itsMoveX;
    private final int itsMoveY;
    private final IPuzzle itsGame;

    protected Move(int moveX, int moveY, IPuzzle game) {
        itsMoveX = moveX;
        itsMoveY = moveY;
        itsGame = game;
    }
    
    /* (non-Javadoc)
     * @see de.devisnik.shifting.impl.IHoleMover#move(de.devisnik.shifting.impl.Puzzle)
     */
    public boolean execute() {
        Point position = itsGame.getHole().getPosition();
        return itsGame.shiftPieceAt(position.x+itsMoveX, position.y+itsMoveY);
    }
    
}
